Socket
Socket
Sign inDemoInstall

mdast-util-mdx

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdast-util-mdx

mdast extension to parse and serialize MDX (or MDX.js)


Version published
Weekly downloads
1.4M
decreased by-15.69%
Maintainers
2
Weekly downloads
 
Created

What is mdast-util-mdx?

The mdast-util-mdx npm package is a utility tool designed to work with MDX (Markdown for the component era) and MDAST (Markdown Abstract Syntax Tree). It provides functions to parse and serialize MDX documents, allowing developers to manipulate MDX content programmatically within the unified ecosystem.

What are mdast-util-mdx's main functionalities?

Parsing MDX

This feature allows the parsing of MDX text into an MDAST format, enabling further manipulation or inspection of the structure.

import { fromMarkdown } from 'mdast-util-mdx';
const mdxText = '# Hello, MDX!';
const mdast = fromMarkdown(mdxText, {extensions: [mdx()] });

Serializing MDX

This feature enables the serialization of an MDAST structure back into a string of MDX, useful for generating MDX files programmatically.

import { toMarkdown } from 'mdast-util-mdx';
const mdast = {type: 'root', children: [{type: 'heading', depth: 1, children: [{type: 'text', value: 'Hello, MDX!'}]}]};
const mdxText = toMarkdown(mdast, {extensions: [mdxToMarkdown()] });

Other packages similar to mdast-util-mdx

Keywords

FAQs

Package last updated on 12 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc